<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
/*
	选择卡券modal，通过访问此页面选择获取指定卡券id
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
	//会员列表
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$return['params']=$params=array();
	$params=array('uniacid'=>$_SESSION['uniacid']);
	$fields=array('nickname','mobile','id');
	if($_RQ['find']){
		$params2=array('uniacid'=>$_SESSION['uniacid']);
		$field=in_array($_RQ['field'],$fields)?$_RQ['field']:'nickname';
		$params2[$field.' like']='%'.$_RQ['find'].'%';
		$return['params']['find']=$_RQ['find'];
		$return['params']['field']=$field;
		$mids=pdo_getall('core_members',$params2,array('id','nickname'),'id');
		if($mids){
			$mids=array_keys($mids);
		}else{
			$mids=-1;
		}
		$params['mid']=$mids;
	}
	$list=pdo_getslice('jy_mlianfee_member',$params,array($pindex,$psize),$total,'','','id desc');
	if($list){
		foreach($list as &$item){
			$item['member']=cfc('core')->member_show($item['mid']);
		}
	}
	$return['list']=$list;
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$return['htmls']=array(
		'type'=>'list',
		'list'=>array('data'=>'list','tip'=>'这里只显示生态员！不显示其他会员！','del_one'=>false,'delall'=>false,'edit'=>false,'list'=>array(
			array('name'=>'mid','title'=>'MID','type'=>'string'),
		    array('name'=>'member','title'=>'会员','type'=>'member'),
		),'action'=>array(
			array('type'=>'modal_result','name'=>'mid','title_field'=>'nickname','title'=>'选取'),
		)),
		'search_one'=>array('name'=>'find','select_name'=>'field','select_title'=>'筛选','is_radio'=>true,'options'=>'fields'),
	);
	$return['fields']=array(
		'id'=>'会员ID',
		'nickname'=>'会员昵称',
		'mobile'=>'会员手机',
	);
	exi($return);

?>